package excercise;

import java.util.Scanner;

public class EX05_034 {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		FahrenheitVO fhv = new FahrenheitVO();
		
		System.out.print("화씨 온도를 입력하시오 : ");
		fhv.setFahrenheit(sc.nextFloat());
		
		fhv.setCentigrade(FahrenheitService.calculator(fhv.getFahrenheit()));

		System.out.println(fhv.toString());
		
	}
}

class FahrenheitVO {
	float fahrenheit;
	float centigrade;	
	
	public FahrenheitVO() {
		fahrenheit = 0;
	}
	public FahrenheitVO(float fahrenheit) {
		this.fahrenheit = fahrenheit; 
	}
	
	public void setFahrenheit(float fahrenheit) { this.fahrenheit = fahrenheit; }
	public void setCentigrade(float centigrade) { this.centigrade = centigrade; }
	public float getFahrenheit() { return fahrenheit; }
	public float getCentigrade() { return centigrade; }
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("○ 입력된 화씨온도 : ").append(getFahrenheit())
		.append("\n○ 산출된 섭씨온도 : ").append(getCentigrade());
		return sb.toString();
	}
}

class FahrenheitService {
	static float calculator(float fahrenheit) {
		return Math.round(((100 / 180f) * (fahrenheit - 32)) * 100) / 100f;
	}
}